#http://mrbook.org/tutorials/make/

CC=gcc
CFLAGS=-lm -I -Wall -Werror
LDFLAGS=
SOURCES=main.c pgm_io.c coder.c macro_defs.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=codec

all: macro_defs.h $(SOURCES) $(EXECUTABLE)
CFLAGS := -O2 $(CFLAGS)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(CFLAGS) $(OBJECTS) -o $@

debug: macro_defs.h $(SOURCES) $(EXECUTABLE)
CFLAGS := -g $(CFLAGS)

clean:
	rm *.o $(EXECUTABLE)
zip:
	rm *zzz*
p:
	rm ../imgs/*zzz*

